<?php

/**
 * This is the model class for table "t_sbu".
 *
 * The followings are the available columns in table 't_sbu':
 * @property string $KDLVL1
 * @property string $KDLVL2
 * @property string $KDLVL3
 * @property string $KDLAMP
 * @property integer $NOURUT
 * @property string $KDSBU
 * @property string $NMSBU
 * @property string $SATUAN
 * @property string $BIAYA
 * @property string $KETERANGAN
 * @property string $NMITEM
 * @property string $SATKEG
 */
class TSbu extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TSbu the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 't_sbu';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('NOURUT', 'numerical', 'integerOnly'=>true),
			array('KDLVL1, KDLAMP', 'length', 'max'=>2),
			array('KDLVL2, KDLVL3', 'length', 'max'=>3),
			array('KDSBU', 'length', 'max'=>6),
			array('NMSBU', 'length', 'max'=>200),
			array('SATUAN', 'length', 'max'=>30),
			array('BIAYA', 'length', 'max'=>19),
			array('KETERANGAN', 'length', 'max'=>150),
			array('NMITEM', 'length', 'max'=>120),
			array('SATKEG', 'length', 'max'=>5),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('KDLVL1, KDLVL2, KDLVL3, KDLAMP, NOURUT, KDSBU, NMSBU, SATUAN, BIAYA, KETERANGAN, NMITEM, SATKEG', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'KDLVL1' => 'Kdlvl1',
			'KDLVL2' => 'Kdlvl2',
			'KDLVL3' => 'Kdlvl3',
			'KDLAMP' => 'Kdlamp',
			'NOURUT' => 'Nourut',
			'KDSBU' => 'Kdsbu',
			'NMSBU' => 'Nmsbu',
			'SATUAN' => 'Satuan',
			'BIAYA' => 'Biaya',
			'KETERANGAN' => 'Keterangan',
			'NMITEM' => 'Nmitem',
			'SATKEG' => 'Satkeg',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('KDLVL1',$this->KDLVL1,true);
		$criteria->compare('KDLVL2',$this->KDLVL2,true);
		$criteria->compare('KDLVL3',$this->KDLVL3,true);
		$criteria->compare('KDLAMP',$this->KDLAMP,true);
		$criteria->compare('NOURUT',$this->NOURUT);
		$criteria->compare('KDSBU',$this->KDSBU,true);
		$criteria->compare('NMSBU',$this->NMSBU,true);
		$criteria->compare('SATUAN',$this->SATUAN,true);
		$criteria->compare('BIAYA',$this->BIAYA,true);
		$criteria->compare('KETERANGAN',$this->KETERANGAN,true);
		$criteria->compare('NMITEM',$this->NMITEM,true);
		$criteria->compare('SATKEG',$this->SATKEG,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}